﻿#region Usings
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Web;
using DotNet.Data;
using DotNet.Model;
#endregion


namespace DotNet.Business
{
    /// <summary>
    /// Url转发处理
    /// </summary>
    public class UrlTrans
    {
        #region 生成符合标准的静态化url（default）
        /// <summary>
        /// 生成符合标准的静态化url（default）
        /// </summary>
        /// <param name="type"></param>
        /// <param name="p1"></param>
        /// <param name="p2"></param>
        /// <param name="p3"></param>
        /// <param name="p4"></param>
        /// <param name="p5"></param>
        /// <param name="p6"></param>
        /// <returns></returns>
        static public string DotTrans(string type,string p1,string p2,string p3,string p4,string p5,string p6)
        {
            string ret = "",transParm="",origParm="";

            if (type == "productList")
            {
                transParm = "productList-" + p1;
                origParm = "productList.aspx?ClassId=" + p1;
            }
            if (type == "productType")
            {
                transParm = "productType-" + p1;
                origParm = "productList.aspx?Ptype=" + p1;
            }
            if (type == "productList-s")
            {
                transParm = "productList-s" + p1+"-" + p2 +"-"+ p3+"-"+p4+"-"+p5;
                origParm = "productList.aspx?PageSize=" + p1 + "&StyleType=" + p2 + "&ClassId=" + p3 + "&Key=" + p4 + "&Ptype=" + p5;
            }
            if (type == "productList-p")
            {
                transParm = "productList-p" + p1 + "-" + p2 + "-" + p3 + "-" + p4 + "-" + p5 + "-" + p6;
                origParm = "productList.aspx?PageSize=" + p1 + "&StyleType=" + p2 + "&ClassId=" + p3 + "&Key=" + p4 + "&Ptype=" + p5 + "&CurrentPage="+ p6;
            }
            if (type == "productKey")
            {
                transParm = "productKey-"+ p1;
                origParm = "productList.aspx?Key=" + p1;
            }
            if (type == "product-d")
            {
                transParm = "product-d" + p1 + "-" + p2 + "-" + p3 + "-" + p4;
                origParm ="ProductDetails.aspx?ClassId="+p1+"&Ptype="+p2+"&Key="+p3+"&CurrentIndex="+p4;
            }
        
            if (type == "boardList")
            {
                transParm = "BoardList-" + p1;
                origParm = "BoardList.aspx?BigClassID=" + p1;
            }
            if (type == "board")
            {
                transParm = "Board-" + p1;
                origParm = "Board.aspx?SmallClassID=" + p1;
            }
            if (type == "board3")
            {
                transParm = "Board-" + p1+"-"+p2+"-"+p3;
                origParm = "Board.aspx?SmallClassID=" + p1+"&Page="+p2+"&BigPage="+p3;
            }
            if (type == "user")
            {
                transParm = "User-" + p1;
                origParm = "UserInfo.aspx?UserID=" + p1;
            }
            return transParm+".html";
        }
        #endregion


        #region 生成符合标准的静态化url（testyle500kv）
        static public string TransUrl(string type, string p1, string p2, string p3, string p4, string p5, string p6)
        {
            string ret = "", transParm = "", origParm = "";
            switch (type)
            {
                case "productClass":
                    transParm = "productClass-" + p1;
                    origParm = "productClass.aspx?pClassID=" + p1;
                    break;
                case "Completeprogram":
                    transParm = "Completeprogram-" + p1;
                    origParm = "Completeprogram.aspx?pcid=" + p1;
                    break;
                case "productDetail":
                    transParm = "productDetail-" + p1;
                    origParm = "productDetail.aspx?productid=" + p1;
                    break;
                case "newslist":
                    transParm = "newslist-" + p1;
                    origParm = "newslist.aspx?CurrentIndex=" + p1;
                    break;
                case "newsdetails":
                    transParm = "newsdetails-" + p1;
                    origParm = "newsdetails.aspx?nid=" + p1;
                    break;
                case "Recruitmentdetails":
                    transParm = "Recruitmentdetails-" + p1;
                    origParm = "Recruitmentdetails.aspx?rid=" + p1;
                    break;
                default:
                    break;
            }          
            return transParm + ".html";
        }
        #endregion
    }
}
